<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-sm12">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-tab layui-tab-brief layadmin-latestData">
                            <ul class="layui-tab-title">
                                <li class="layui-this">待办事项<span style="color: red;font-size: 12px">点击待办事项可跳转值全部内容</span></li>

                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <table id="topSearch" lay-filter="topSearch"></table>
                                </div>
                                <!--                                <div class="layui-tab-item">-->
                                <!--                                    <table id="LAY-index-topCard"></table>-->
                                <!--                                </div>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
<!--        <div class="layui-col-sm6 layui-col-md3">-->
<!--            <div class="layui-card">-->
<!--                <div class="layui-card-header">-->
<!--                    总客户量-->
<!--                </div>-->
<!--                <div class="layui-card-body layuiadmin-card-list">-->
<!--                    <p class="layuiadmin-big-font">{$customer ?? 0}</p>-->
<!--                    <p>-->
<!--                        今日新增-->
<!--                        <span class="layuiadmin-span-color">{$today_customer ?? 0}</span>-->
<!--                    </p>-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->
<!--        <div class="layui-col-sm6 layui-col-md3">-->
<!--            <div class="layui-card">-->
<!--                <div class="layui-card-header">-->
<!--                    总项目量-->
<!--                    &lt;!&ndash;                    <span class="layui-badge layui-bg-cyan layuiadmin-badge">月</span>&ndash;&gt;-->
<!--                </div>-->
<!--                <div class="layui-card-body layuiadmin-card-list">-->
<!--                    <p class="layuiadmin-big-font">{$project ?? 0}</p>-->
<!--                    <p>-->
<!--                        今日新增-->
<!--                        <span class="layuiadmin-span-color">{$today_project ?? 0}</span>-->
<!--                    </p>-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->
<!--        <div class="layui-col-sm6 layui-col-md3">-->
<!--            <div class="layui-card">-->
<!--                <div class="layui-card-header">-->
<!--                    总文件数-->
<!--                    &lt;!&ndash;                    <span class="layui-badge layui-bg-green layuiadmin-badge">年</span>&ndash;&gt;-->
<!--                </div>-->
<!--                <div class="layui-card-body layuiadmin-card-list">-->

<!--                    <p class="layuiadmin-big-font">{$file ?? 0}</p>-->
<!--                    <p>-->
<!--                        今日上传-->
<!--                        <span class="layuiadmin-span-color">{$today_file ?? 0}</span>-->
<!--                    </p>-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->
<!--        <div class="layui-col-sm6 layui-col-md3">-->
<!--            <div class="layui-card">-->
<!--                <div class="layui-card-header">-->
<!--                    总人数-->
<!--                    &lt;!&ndash;                    <span class="layui-badge layui-bg-orange layuiadmin-badge">月</span>&ndash;&gt;-->
<!--                </div>-->
<!--                <div class="layui-card-body layuiadmin-card-list">-->

<!--                    <p class="layuiadmin-big-font">{$admin ?? 0}</p>-->
<!--                    <p>-->
<!--                        总人数-->
<!--                        <span class="layuiadmin-span-color">{$admin ?? 0}</span>-->
<!--                    </p>-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->
        <div class="layui-col-sm12">
            <div class="layui-card">
                <div class="layui-card-header">系统公告</div>
                <div class="layui-card-body">
                    <ul class="layuiadmin-card-status layuiadmin-home2-usernote">
                        {foreach $system as $key=>$value}
                        <li>
                            <h3>{$value.title}</h3>
                            <span>{$value.create_time}</span>
                            <a href="javascript:;" layadmin-event="replyNote" data-content="{$value.parsedown_content}"
                               data-id="{$value.id}"
                               class="layui-btn layui-btn-xs layuiadmin-reply">查看</a>
                        </li>
                        {/foreach}
                    </ul>
                </div>
            </div>
        </div>


    </div>
</div>

<script src="/static/admin/layui/layui.js"></script>
<script>
    var check_url = "{:url('home/check_content')}", approval = "{:url('journal/approval')}",
        grade = "{:url('journal/grade')}", url = "{:url('Myworkitem/edit')}";
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'console'], function () {
        var $ = layui.$, a = layui.admin, form = layui.form, e = (layui.$, layui.table), table = layui.table;
        a.events.replyNote = function (e) {
            var a = e.data("id");
            var param = $.param({'id': e.data("id")});
            layer.open({
                type: 2,
                id: 'top_' + a,
                shade: false,
                area: ['50%', '50%'],
                maxmin: true,
                content: check_url + '?' + param
            });
        };
        table.render({
            elem: "#topSearch",
            url: "{:url('home/journal')}",
            size:"sm"
            , cols: [
                [
                    {field: 'id', title: ('id'), hide: true},
                    {field: 'url', title: ('id'), hide: true},
                    {field: 'bizobjectid', title: ('业务表id'), hide: true},
                    {field: 'schemeid', title: "schemeid", hide: true},
                    {field: 'instancestatus', title: "instancestatus", hide: true},
                    {field: 'flowcode', title: "flowcode", hide: true},
                    {field: 'bizscheme', title: "bizscheme", hide: true},
                    {field: "instancecode", align: "center", title: "流水号"},
                    {field: "flowname", align: "center", title: "流程名称"},
                    {field: "stepname", align: "center", title: "步骤"},
                    {
                        field: "nickname", align: "center", title: "发起人名称"
                    },
                    {field: "createtime", align: "center", title: "创建时间"},
                    {field: "completedtime", align: "center", title: "完成时间"},
                    {
                        field: "instancestatus", align: "center", title: "状态", templet: function (row) {
                            var res = '';
                            var className = '';
                            switch (row.instancestatus) {
                                case 0:
                                    res = '待提交';
                                    className = 'primary';
                                    break;
                                case  1:
                                    res = '审批中';
                                    className = 'info';
                                    break;
                                case 2:
                                    res = '已完成';
                                    className = 'success';
                                    break;
                                case 3:
                                    res = '已取消';
                                    className = 'success';
                                    break;
                                default:
                                    break;
                            }
                            return '<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-xs" data-toggle="tooltip" "><span class="label label-' + className + '">' + res + '</span></a>';
                        }
                    }]],
            response: {
                statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
            },
            parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code,
                    "count": res.total, //解析数据长度
                    "data": res.data, //解析数据列表
                };

            },
            text: {
                none: '呀！一条数据都没有'
            },
            page: true,
            limit: 10,
        });


        //监听行单击事件（双击事件为：rowDouble）
        //监听行单击事件（双击事件为：rowDouble）
        table.on('row(topSearch)', function (obj) {
            var data = obj.data;
            var param = $.param({'ids': data.bizobjectid, 'taskid': data.id, 'table': data.bizscheme});
            var urls = url + '?' + param

            var title = data.flowname + '(' + data.instancecode + ')';
            top.layui.index.openTabsPage(urls, title);  //完成页面跳转
            // layer.open({
            //     type: 2
            //     , title: title
            //     , content: urls
            //     , area: ['80%', '80%']
            //     , maxmin: true
            //     // , btn: ['确定', '流程图', '取消']
            //     // , success: function (res) {
            //     //     console.log(data.instancestatus);
            //     // }
            // });

            //标注选中样式
            obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
        });

        $('.layui-this').on("click",function () {
            top.layui.index.openTabsPage("{:url('Myworkitem/index')}", "待办任务");  //完成页面跳转
        })
    });
</script>
